package com.shop.cereshop.app.controller.location;

import com.shop.cereshop.app.domain.region.RegionGroupDTO;
import com.shop.cereshop.app.service.location.RegionService;
import com.shop.cereshop.commons.constant.CoReturnFormat;
import com.shop.cereshop.commons.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@RequestMapping("/app/region")
@Api(value = "城市列表获取接口", tags = "城市列表获取接口")
public class RegionController {
    @Autowired
    private RegionService regionService;
    @GetMapping("/three/list")
    @ApiOperation("获取城市列表")
    public Result<List<RegionGroupDTO>> getThreeLevelData() {
        List<RegionGroupDTO> regionDatas = regionService.buildThreeLevelData();
        return new Result<>(regionDatas, CoReturnFormat.SUCCESS);
    }
}
